-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply memoization in get_all_universes
#2995
Conversation
One note here is that the pattern: if memo and self in memo:
return {} was pre-existing in other calls using memoization. I stuck with this here for consistency even though this might be more explicit and better: if memo is not None and self in memo:
return {} Happy to update this across the board at the reviewer's request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @pshriwise! Two things seem a little weird to me in the implementation but hopefully it's easy to fix:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pshriwise!
Co-authored-by: Paul Romano <[email protected]>
Description
While working on a model with TRISO compacts, @aprilnovak noticed that the
Geometry.get_all_universes
method was taking a long time (3+ hours) -- preplexing as theget_all_cells
call was taking less than a second.It turns out that we weren't using the memoization objects we have in place for this call/chain-of-calls in the geometry objects. This PR adds the use of memoization for that call.
I haven't added any tests here as the set of tests we have in place exercises these methods significantly -- they should just be faster now.
Checklist
I have run clang-format (version 15) on any C++ source files (if applicable)I have made corresponding changes to the documentation (if applicable)I have added tests that prove my fix is effective or that my feature works (if applicable)